﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using RN.ERP.Web.UserControl;

namespace RN.ERP.Web.Person
{
    public partial class PersonEmpView : System.Web.UI.Page
    {
        public string PageTitle
        {
            get
            {
                return ConfigurationManager.AppSettings["sysTitle"];
            }
        }

        public string Type
        {
            get
            {
                return this.Request.QueryString["type"] == null ? string.Empty : this.Request.QueryString["type"].ToString();
            }
        }

        protected Control control;
        protected void Page_Load(object sender, EventArgs e)
        {
            ContentPlaceHolder content = new ContentPlaceHolder();
            switch (Type)
            {
                ////加载用户控件 
                case "14":
                    control = Page.LoadControl("~/UserControl/UCPsnEmployeeInfo14.ascx");
                    ////这里命名是为了可以取得里面控件的值 
                    control.ID = "UCPsnEmployeeInfo1";
                    ////先找到ContentPlaceHolder的ID
                    form1.Controls.Add(control);
                    ((UCPsnEmployeeInfo14)form1.FindControl("UCPsnEmployeeInfo1")).WindowModel = 1;
                    if (!this.ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "PsnEmpInfo"))
                    {
                        this.ClientScript.RegisterClientScriptInclude("PsnEmpInfo", ResolveClientUrl("~/Scripts/PsnEmpInfo14.js"));
                    }
                    break;
                default:
                    control = Page.LoadControl("~/UserControl/UCPsnEmployeeInfo.ascx");
                    ////这里命名是为了可以取得里面控件的值 
                    control.ID = "UCPsnEmployeeInfo1";               
                    ////先找到ContentPlaceHolder的ID
                    form1.Controls.Add(control);
                    ((UCPsnEmployeeInfo)form1.FindControl("UCPsnEmployeeInfo1")).WindowModel = 1;
                    if (!this.ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "PsnEmpInfo"))
                    {
                        this.ClientScript.RegisterClientScriptInclude("PsnEmpInfo", ResolveClientUrl("~/Scripts/PsnEmpInfo.js"));
                    }
                    break;
            } 
        }
    }
}